package com.fzz.learning_forum.dao;

import com.fzz.learning_forum.domain.Reply;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Mapper
@Component
public interface ReplyMapping {

    //添加回复信息
    @Insert("insert into tb_reply(content,review_name,reply_name,article_id,comment_id,user_id,created)" +
            "values(#{content},#{review_name},#{reply_name},#{article_id},#{comment_id},#{user_id},#{created})")
    public Integer publishReply(Reply reply);

    //查询对应的回复
    @Select("select * from tb_reply where article_id=#{article_id}")
    public List<Reply> selectReply(@Param("article_id")Integer article_id);
}
